﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkFlowAccredAdd.aspx.cs"
    Inherits="ZX.WebApp.WorkFlow.WorkFlowAccredAdd" %>

<%@ Register Assembly="DevExpress.Web.v12.1, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxSiteMapControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.1" Namespace="DevExpress.Web.ASPxSiteMapControl"
    TagPrefix="dx" %>
<%@ Register Assembly="ZX.BPM.Web" Namespace="ZX.WebApp.WebControls" TagPrefix="cc1" %>
<%@ Register TagPrefix="dx" Namespace="DevExpress.Web.ASPxEditors" Assembly="DevExpress.Web.ASPxEditors.v12.1, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" %>
<%@ Register Assembly="DevExpress.Web.v12.1, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxSiteMapControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <style type="text/css">
        #AccreditTree0
        {
            margin-top: 0px;
            margin-left: 50px;
            width: 400px;
            float: left;
        }
        #AccreditTree1
        {
            width: 350px;
            float: left;
        }
    </style>
    <title></title>
    <link href="../Crm/Css/default.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/reset-fonts-grids/reset-fonts-grids.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/menu/assets/skins/sam/menu.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link type="text/css" rel="stylesheet" href="../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../Scripts/yui_2.9.0/build/treeview/assets/treeview-core.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/fonts/fonts-min.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/treeview/assets/skins/sam/treeview.css" />
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <!-- OPTIONAL: JSON Utility (for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <!-- OPTIONAL: Connection Manager (enables XHR for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <!-- OPTIONAL: Get Utility (enables dynamic script nodes for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <!-- OPTIONAL: Calendar (enables calendar editors) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/calendar/calendar-min.js"></script>
    <!-- Source files -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <link href="../Styles/base.css" rel="stylesheet" type="text/css" />
    <link href="../../Css/hfmenu.css" type="text/css" rel="stylesheet" />
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/CombinButton.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript">
        YAHOO.namespace("example.container")
        function ShowDialog(fn, id, src) {
            var handleSubmit = function () {
                var editwindow = document.getElementById("EditUIWindow4");
                if (editwindow) {
                    editwindow.contentWindow.ChooseInfo();
                }
                YAHOO.example.container.dialog3.hide();
            };
            var handleCancel = function () {
                this.cancel();
            };
            var handleSuccess = function (o) {
                var response = o.responseText;
                response = response.split("<!")[0];
                document.getElementById("resp").innerHTML = response;
            };
            var handleFailure = function (o) {
                alert("Submission failed: " + o.status);
                //                  var response = o.responseText;
                //                  response = response.split("<!")[0];
                //                  document.getElementById("resp").innerHTML = response;
            };
            var handleFailure = function (o) {
                alert('出错了handleFailure');
            };
            var const_EditWindowWidth = "400px",
		const_EditWindowHeight = "300px";
            // Remove progressively enhanced content class, just before creating the module
            YAHOO.util.Dom.removeClass("dialog3", "yui-pe-content");

            // Instantiate the Dialog
            YAHOO.example.container.dialog3 = new YAHOO.widget.Dialog("dialog3",
							    { width: const_EditWindowWidth,
							        height: const_EditWindowHeight,
							        fixedcenter: true,
							        visible: false,
							        draggable: true,
							        close: true,
							        autofillheight: "body",
							        constraintoviewport: true,
							        buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								          { text: "取消", handler: handleCancel}]
							    });
            // Wire up the success and failure handlers
            YAHOO.example.container.dialog3.callback = { success: handleSuccess,
                failure: handleFailure
            };
            // Render the Dialog
            YAHOO.example.container.dialog3.render();
            _fn = fn;
            _id = id;
            document.getElementById("EditUIWindow4").src = src;
            YAHOO.example.container.dialog3.show();
        }
      
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bg_up" align="center">
        <tr>
            <td style="height: 15px; border: 1px;" class="title_1">
                新增流程代理
            </td>
        </tr>
        <tr>
            <td style="height: 10px; width: 100%">
                <hr />
            </td>
        </tr>
        <tr>
            <td style="width: 100%; height: 25px;">
                <table style="width: 100%; height: 100%; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid;
                    border-left: #bdcaea 1px solid; border-top: #bdcaea 1px solid;" cellspacing="0"
                    cellpadding="0">
                    <tr style="width: 100%" class="title_1">
                        <td style="height: 25px; width: 30%; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" class="articlelist" >
                            &nbsp;被代理人：
                        </td>
                        <td style="height: 26px; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" align="left">
                            <asp:TextBox runat="server" ID="txtAccreditToName" Width="200px" Enabled="false"></asp:TextBox>
                        </td>
                    </tr>
                    <tr style="width: 100%" class="title_1">
                        <td style="height: 25px; width: 30%; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" class="articlelist">
                            &nbsp;代理人：
                        </td>
                        <td style="height: 26px; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" align="left">
                            <input type="hidden" id="CustomId" runat="server" name="CustomId" />
                            <input id="txtCustomId" runat="server" readonly="readonly" name="txtCustomId" type="text"
                                style="width: 200px;" />
                            <button id="btnCustomId" name="n" type="button" class="btnCheck" style="width: 65px">
                              
                                选择用户</button>
                        </td>
                    </tr>
                    <tr style="width: 100%" class="title_1">
                        <td style="height: 25px; width: 30%; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" class="articlelist">
                            &nbsp;开始时间：
                        </td>
                        <td style="width: 230px; height: 26px; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" align="left">
                            <input name="StartDate" class="title_1" type="text" size="13" style="width: 200px;"
                                readonly="readonly" id="Start_Date" runat="server" onclick="WdatePicker({el:'Start_Date',dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
                        </td>
                    </tr>
                    <tr style="width: 100%" class="title_1">
                        <td style="height: 25px; width: 30%; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" class="articlelist">
                            &nbsp;结束时间：
                        </td>
                        <td style="width: 130px; height: 26px; border-right: #bdcaea 1px solid; border-bottom: #bdcaea 1px solid; border-left: #bdcaea 1px solid;
                                    border-top: #bdcaea 1px solid;" align="left">
                            <input name="ReportDate" class="title_1" type="text" size="13" style="width: 200px;"
                                readonly="readonly" id="Report_Date" runat="server" onclick="WdatePicker({el:'Report_Date',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'Start_Date\')}'})" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="height: 10px; width: 100%">
                <hr />
            </td>
        </tr>
        <tr>
            <td style="height: 15px; border: 1px;" class="title_1">
                类型 - 工作流 全选
                <input id="chkAll" type="checkbox" onclick="checkSelectedNode()" />
                <asp:Button ID="btnSave" Height="20px" Width="50px" runat="server" Text="保存" OnClientClick="return ChooseInfo()"
                    OnClick="btnSave_Click" />
                <asp:TextBox ID="txtvlues" runat="server" Style="display: none"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 80%; border-right: #bdcaea 2px solid; border-bottom: #bdcaea 2px solid;
                border-left: #bdcaea 2px solid; border-top: #bdcaea 2px solid;">
                <asp:Literal runat="server" ID="lteAccredit"></asp:Literal>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="yui-skin-sam">
                <div id="dialog3" class="yui-pe-content" />
                <div class="hd">
                </div>
                <div class="bd">
                    <iframe id="EditUIWindow4" frameborder="0" src="" style="width: 100%; height: 100%;
                        margin: 0px; padding: 0px;"></iframe>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
<script type="text/javascript">
    var tree2 = null;
    (function () {
        var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event;

        var makeBranch = function (parent, label) {
        }
        tree2 = new YAHOO.widget.TreeView("AccreditTree0");
        makeBranch(tree2.getRoot());
        tree2.setNodesProperty('propagateHighlightUp', true);
        tree2.setNodesProperty('propagateHighlightDown', true);
        tree2.subscribe('clickEvent', tree2.onEventToggleHighlight);
        tree2.render();
        tree1 = new YAHOO.widget.TreeView("AccreditTree1");
        makeBranch(tree1.getRoot());
        tree1.setNodesProperty('propagateHighlightUp', true);
        tree1.setNodesProperty('propagateHighlightDown', true);
        tree1.subscribe('clickEvent', tree1.onEventToggleHighlight);
        tree1.render();


    })();


    //设置已选节点
    function checkSelectedNode() {
        var chall = document.getElementById("chkAll");

        tree1.render();
        tree2.render();
        try {
            var childNode = tree1.getNodeCount();
            var topNode = tree1.getNodesByProperty("href");
            if (chall.checked) {
                for (var i = 0; i < childNode; ++i) {
                    topNode[i].highlightState = 1;
                }
            }
            else {
                for (var i = 0; i < childNode; ++i) {
                    topNode[i].highlightState = 0;
                }
            }
            tree1.render();
            var childNodes = tree2.getNodeCount();
            var topNodes = tree2.getNodesByProperty("href");
            if (chall.checked) {
                for (var i = 0; i < childNodes; ++i) {
                    topNodes[i].highlightState = 1;
                }
            }
            else {
                for (var i = 0; i < childNodes; ++i) {
                    topNodes[i].highlightState = 0;
                }
            }
            tree2.render();
        }
        catch (e) {
        }
        finally {
        }
    }

    //得到选中的值
    function ChooseInfo() {
        var hiLit1 = tree1.getNodesByProperty('highlightState', 1);
        var hiLit2 = tree2.getNodesByProperty('highlightState', 1);
        var lblworkflowID = "";
        if (YAHOO.lang.isNull(hiLit1) && YAHOO.lang.isNull(hiLit2)) {
            return;
        }
        else {
            if (!YAHOO.lang.isNull(hiLit1)) {
                for (var i = 0; i < hiLit1.length; i++) {
                    if (hiLit1[i].href != undefined) {
                        var items = hiLit1[i].href.split("#@")[1];
                        if (lblworkflowID == "") {
                            lblworkflowID = items
                        }
                        else {
                            lblworkflowID += ',' + items;
                        }
                    }
                }
            }
            if (!YAHOO.lang.isNull(hiLit2)) {
                for (var i = 0; i <  hiLit2.length; i++) {
                    if (hiLit2[i].href != undefined) {
                        var items = hiLit2[i].href.split("#@")[1];
                        if (lblworkflowID == "") {
                            lblworkflowID = items
                        }
                        else {
                            lblworkflowID += ',' + items;
                        }
                    }
                }
            }


        }
        document.getElementById("txtvlues").value = lblworkflowID;

    }
 
</script>
</html>
